package com.sky.controller.user;

import com.sky.entity.Customer;
import com.sky.entity.OrderRoom;
import com.sky.result.Result;
import com.sky.service.CustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    /**
     * 注册
     * @param customer
     * @return
     */
    @PostMapping("/register")
    public Result<Customer> register(@RequestBody Customer customer){
        log.info("人员注册{}",customer);
        customerService.register(customer);
        return Result.success(customer);
    }

    @PostMapping("/order")
    public Result<OrderRoom> order(@RequestBody OrderRoom orderRoom){
        log.info("订单信息");
        customerService.order(orderRoom);
        return Result.success(orderRoom);
    }

}
